TTS Commands


MMB offers Text-to-Speech features through it's script language. Main features of TTS commands are:

  •  Installation of TTS engine
  •  Speaking of text from variables and objects
  •  Voice pitch and speed settings

 

InstallTTS()
Description
 


Installs TTS engine if it has not been installed previously on the running system. Command checks TTS status and performs installation if needed. No parameters required.

When distributing project, make sure to include TTS engine installation files ( msttss22L.exe, spchapi.exe) in folder labeled TTS, inside your project folder.

 

Code Example
 

**Install TTS engine :
InstallTTS()

Additional Info
 

If your project uses TTS features, it is recommended to call InstallTTS at the project startup, just to make sure TTS engine is ready for use.

TTS installation files are placed in TTS subfolder of MMB's folder. In case you don't have 'em, install files can be downloaded from:

http://www.mediachance.com

 

InitTTS()
Description
 


Initializes TTS engine. No parameters required.

During the initialization, black info box is displayed in the center of the screen. While TTS startup might take a few seconds on low-performance computers, it is recommended to:

a) call this command at the project startup

b) do not use TTS engine at the very beginning of project startup, but with commands like Pause() and ScriptTimer() give a few seconds to TTS engine for initialization.

Code Example
 

** Initialize TTS engine:
InitTTS()

 

Say("Text$")
Description
 


Reads text set either as a command parameter or string variable .

In first case, text is fixed as a command parameter:

Say("Hello from MMB")


In second case, you will first set text to a string variable:

text$='Hello from MMB'

And then set string variable to Say command:

Say("text$")


TTS engine must be installed and initialized.

Code Examples
 

** Read text from fixed command parameter:
Say("Welcome to my project")

** Read text from string variable as a command parameter:
text$='Welcome to my project'
Say("text$")

 

SpeakText("ObjectLabel")
Description
 


Reads text from any Text, Button or Paragraph object.

Object label is set as a command parameter.


If object with text is labeled:

ShoutBox

...then it's label put into command will look like this:

SpeakText("ShoutBox")


TTS engine must be installed and initialized.

Code Example
 

** Read text from object labeled "StoryParagraph":
SpeakText("StoryParagraph")

 

StopTTS()
Description
 


Stops reading text (started using Say or SpeakText command).

Code Example
 

** Stop reading text:
StopTTS()

 

PauseTTS()
Description
 


Pauses reading of text (started using Say or SpeakText command).

Use ResumeTTS command to resume reading.

Code Example
 

** Pause reading text:
PauseTTS()

 

ResumeTTS()
Description
 


Resumes reading of text (after it was paused using PauseTTS command).

Code Example
 

** Resume reading text:
ResumeTTS()

 

PitchTTS("Frequency")
Description
 


Sets pitch of voice for TTS text reading.

Command parameter sets voice frequency (in Hz) either as a fixed parameter or through numerical variable, in range:

50 - 200

Default frequency is 100.


In the first case, frequency is fixed as command parameter:

PitchTTS("80")

In the second case, you will first set frequency to a numerical variable:

pitch=80

And then set numerical variable to PitchTTS command:

PitchTTS("pitch")

Code Examples
 

** Set pitch to 130 Hz from fixed command parameter:
PitchTTS("130")

** Set pitch to 130 Hz from numerical variable as a command parameter:
pitch=130
PitchTTS
("pitch")

 

SpeedTTS("Speed")
Description
 


Sets speed of TTS text reading.

Command parameter sets number of words per minute either as a fixed parameter or through numerical variable, in range:

30 - 450

Default value is 150 words per minute.


In the first case, speed is fixed as a command parameter:

SpeedTTS("300")

In the second case, you will first set speed to a numerical variable:

speed=300

And then set numerical variable to SpeedTTS command:

SpeedTTS("speed")

Code Examples
 

** Set speed to 300 words/min from fixed command parameter:
SpeedTTS("300")

** Set speed to 300 words/min from numerical variable as a
** command parameter:

speed=300
SpeedTTS
("speed")

 

 

MMB Scripting Unleashed by Bokzy, 2003 :: All rights reserved :: http://www.bokzy.com